<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui">


    <ui:define name="content">

        <h:panelGroup >
            <h:form  >
                <p:growl />
                <p:focus id="selectFocus" context="gpSelect" />
                <p:focus id="detailFocus" context="gpDetail" />



                <p:panel header="Manage Salary Cycle" >
                    <h:panelGrid id ="gpVeda" columns="2" >

                        <h:panelGrid id="gpSelect" columns="1"  >
                            <p:panel >
                                <h:panelGrid id="gpSelectText" >
                                    <h:selectOneListbox  id="lstSelect"   size="10" value="#{salaryCycleController.current}" style="min-width: 223px">
                                        <f:selectItems  value="#{salaryCycleController.salaryCycles}" var="myItem" itemValue="#{myItem}" itemLabel="#{myItem.name}" ></f:selectItems>
                                        <f:ajax render="gpDetail tbl" execute="lstSelect" >
                                        </f:ajax>
                                    </h:selectOneListbox>
                                </h:panelGrid>
                                <h:panelGrid id="gpSelectButtons" columns="3"  >
                                    <p:commandButton ajax="false" value="Fill " action="#{salaryCycleController.listAllSalaryCycles()}"/>
                                    <p:commandButton id="btnAdd" value="Add" ajax="false" action="#{salaryCycleController.prepareAdd()}" styleClass="buttons" >

                                    </p:commandButton>
                                    <p:commandButton ajax="false" id="btnDelete" onclick="if (!confirm('Are you sure you want to delete this record?'))
                                                return false;" action="#{salaryCycleController.delete()}"  value="Delete"  >
                                    </p:commandButton>
                                </h:panelGrid>
                            </p:panel>
                        </h:panelGrid  >

                        <p:panel id="tbl" styleClass="summeryBorder noBorder">
                            <f:facet name="header">
                                <p:outputLabel value="#{sessionController.institution.name}" />
                                <br></br>
                                <p:outputLabel value="Salary Cycle - #{salaryCycleController.current.name}" />
                            </f:facet>
                            <h:panelGrid id="gpDetail" columns="1">
                                <h:panelGrid id="gpDetailText" columns="2">
                                    <h:outputText  value="Salary From Date " ></h:outputText>
                                    <p:calendar value="#{salaryCycleController.current.salaryFromDate}" pattern="dd MMMM yyyy"  />
                                    <h:outputText  value="Salary To Date " ></h:outputText>
                                    <p:calendar value="#{salaryCycleController.current.salaryToDate}" pattern="dd MMMM yyyy" />
                                    <h:outputText  value="Salary Advance From Date " ></h:outputText>
                                    <p:calendar value="#{salaryCycleController.current.salaryAdvanceFromDate}" pattern="dd MMMM yyyy" />
                                    <h:outputText  value="Salary Advance To Date " ></h:outputText>
                                    <p:calendar value="#{salaryCycleController.current.salaryAdvanceToDate}" pattern="dd MMMM yyyy" />
                                    <h:outputText  value="OT From Date " ></h:outputText>
                                    <p:calendar styleClass="dateTimePicker" value="#{salaryCycleController.current.workedFromDate}" 
                                                pattern="dd MMMM yyyy hh:mm:ss a" />
                                    <h:outputText  value="OT To Date " ></h:outputText>
                                    <p:calendar styleClass="dateTimePicker" value="#{salaryCycleController.current.workedToDate}"
                                                pattern="dd MMMM yyyy hh:mm:ss a" />
                                    <h:outputText  value="Day off / PH  From Date " ></h:outputText>
                                    <p:calendar styleClass="dateTimePicker" value="#{salaryCycleController.current.dayOffPhFromDate}" 
                                                pattern="dd MMMM yyyy hh:mm:ss a" />
                                    <h:outputText  value="Day off / PH  To Date " ></h:outputText>
                                    <p:calendar styleClass="dateTimePicker" value="#{salaryCycleController.current.dayOffPhToDate}"
                                                pattern="dd MMMM yyyy hh:mm:ss a" />
                                </h:panelGrid>
                                <h:panelGrid id="gpDetailButtons" columns="2" styleClass="noPrintButton" >
                                    <p:commandButton ajax="false" id="btnSave" value="Save" action="#{salaryCycleController.saveSelected()}" styleClass="buttons">
                                    </p:commandButton>
                                    <p:commandButton value="Print" ajax="false" action="#" >
                                        <p:printer target="tbl" ></p:printer>
                                    </p:commandButton>
                                </h:panelGrid>
                            </h:panelGrid>
                        </p:panel>
                    </h:panelGrid>
                </p:panel>
            </h:form>

        </h:panelGroup>

    </ui:define>

</ui:composition>
